import Vue from 'vue'
import VueRouter from 'vue-router'
import login from '@/views/login/login.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/Layout/home'
  },
  {
    path: '/login',
    component: login
  },
  {
    path: '/Layout',
    component: () => import(/* webpackChunkName: "Layout" */ '@/views/layout/MyLayout.vue'),
    children: [
      {
        path: 'home',
        component: () => import(/* webpackChunkName: "Home" */ '@/views/Home/MyHome.vue'),
        meta: {
          scrollT: 0 // 保存首页离开时, 滚动条位置
        }
      },
      {
        path: 'user',
        component: () => import(/* webpackChunkName: "User" */ '@/views/User/MyUser.vue')
      }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
